const cloud = require('wx-server-sdk');
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();
const utils = require('../utils/index');  

exports.main = async (event, context) => {

  let _openid = event.params._openid;
  let {drawsNum} = event.params;

  return await db.collection(utils.collectionName).where({
    _openid
  }).update({
    data:{
      drawsNum
    }
  }).then((res)=>{
    console.log(res);
    return true;
  }).catch((res)=>{
    return false;
  })
};